#!/bin/bash
# 
# This is a complete hack. If you're reading this file, you are truly 
# desperate. I pity you. 
#############################################################################

echo "======================================================================"



# These are the required applications 

applist="curl
bc
grep
md5sum
xmlwf
more"

echo 
echo ABOUT bashWebTest

more about.txt

echo "

[Hit ENTER to continue to the dependency check. ]
  "
read foo

echo "======================================================================"
echo 
echo DEPENDENCY CHECK
echo "These applications are usually included by default"


for app in $applist; 
do 
echo You need $app

if [ ! -x $app ]; then
	echo $app is available. 
	$app --version
	else
	echo -e "${red} $app is NOT available!${nc}"
	which $app
	echo need to install and toss $app into your path. 
fi
	echo
done; 

echo 
echo "Text coloring: (nice to have)"
echo -e "${red} This is red (FAIL)"
echo -e "${yellow} This is yellow (WARN)"
echo -e "${nc} This is no color PASS"


echo "======================================================================"
echo 
echo SETUP

if [ -d results -a -w results ] ; then
	echo "Good for you. the results dir is there."
	ls -l | grep results 
else
	mkdir results
fi

echo "
[Hit ENTER to continue to the available tests. ]
  "
read foo


echo "======================================================================"
echo 
echo AVAILABLE FUNCTIONAL TESTS

availtests=`ls -c1 test* `

for i in $availtests ;
 do
 	echo $i && \
 	cat $i | grep testdescription=
 done ;
 
echo "======================================================================"
echo 
echo AVAILABLE HTML VALIDATION TESTS

availtests=`ls -c1 validate* `

for i in $availtests ;
 do
 	echo $i && \
 	cat $i | grep testdescription=
 done ;

echo "
[Hit ENTER to continue to the available functions. ]
  "
read foo

echo "======================================================================"
echo 
echo AVAILABLE functions

availtests=`ls -c1 *function* `

for i in $availtests ;
 do
 	echo $i && \
 	cat $i | grep testdescription=
 done ;

echo "
[Hit ENTER to continue to the licensing info. ]
  "
read foo

echo "======================================================================"
echo 
echo LICENSING INFO

more license.txt

echo
echo "DONE"
echo 

echo ""
echo ""
echo "======================================================================"
echo ""
echo ""


exit 0


